
<template>
  <div class="home">
    {{ originStr }}
      <!-- 第一种写法 -->
      <!--  <hello-world :message="originStr" @update:message="changeMessage" />  -->
      <!-- 第二种写法(.sync语法糖的写法) -->
    <hello-world :message.sync="originStr" />
  </div>
</template>
<script>
// @ is an alias to /src
import HelloWorld from "./components/HelloWorld.vue";
 
export default {
  name: "demoTwenty45",
  components: {
    HelloWorld,
  },
  data() {
    return {
      originStr: "你好",
    };
  },
  methods: {
    changeMessage(str) {
      console.log(str);
      this.originStr = str;
    },

  },
};
</script>
 

